package app.util.image.action
{
	import app.util.*;
	
	import flash.display.*;
	import flash.filters.BlurFilter;
	import flash.geom.*;
	
	public class GaussAction extends AbstractAction
	{
		private var sigma:Number = 0;
		
		public function setValue(s:Number):GaussAction
		{
			this.sigma = s;
			
			return this;
		}
		
		public override function getDescription():String
		{
			return "Gaussion (" + this.sigma.toFixed(1) + ")";
		}
		
		public override function getActionedBitmapData():BitmapData
		{
			var old:BitmapData = Mediator.getCurrentBitmapData();
			var ret:BitmapData = old.clone();
			var filter:BlurFilter = new BlurFilter(this.sigma, this.sigma, 3);
			ret.applyFilter(ret, ret.rect, new Point(0, 0), filter);
			return ret;
		}	
	}
}